#include<iostream>
using namespace std;
int main()
{
	long long int a,b,temp;
	cin>>a>>b;
	if(a<b)
	{
		swap(a,b);
	}
	temp=b;
	cout<<min(temp,(a+b)/3)<<endl;
	return 0;
	
}